import api from '@/config/api';
import { http } from '@/utils/request';

/**
 * 获取聊天详情接口
 * @param {*} talkId 
 * @returns 
 */
export function getTalk(talkId: string) {
  return http.request({
    url: `${api.im}/talk/${talkId}`,
    method: "GET",
  });
}

/**
 * 获取与用户的聊天详情
 * @param {*} talkId 
 * @returns 
 */
export function getTalkByUser(userId: string) {
  return http.request({
    url: `${api.im}/talk/by/user/${userId}`,
    method: "GET",
  });
}

/**
 * 获取聊天列表
 * @returns 
 */
export function getTalkList(params: any) {
  return http.request({
    url: `${api.im}/talk/store/list`,
    method: "GET",
    params
  });
}

/**
 * 获取聊天信息接口
 * @param {*} params 
 * @returns 
 */
export function getTalkMessage(params: any) {
  return http.request({
    url: `${api.im}/message`,
    method: "GET",
    params
  });
}

// 从商品页点击 客服 跳转 获取商品详情
export function jumpObtain(skuId: string, goodsId: string) {
  return http.request({
    url: `/goods/sku/vo/${goodsId}/${skuId}`,
    method: "GET",
  });
}
// 清除未读
// /message/clean/unred
export function clearmeaager() {
  return http.request({
    url: `${api.im}/message/clean/unred`,
    method: "PUT",
  });
}
